/**
 * @author yanggjun
 */

MouseEventListener = {
		button: 0,
		add: function(){
			 this.button = 0;
			 document.addEventListener('mousedown', this.onDocumentMouseDown, false);
	         document.addEventListener('touchstart', this.onDocumentTouchStart, false);
	         document.addEventListener('touchmove', this.onDocumentTouchMove, false);
	         document.addEventListener('mousemove', this.onDocumentMouseMove, false);
	         document.addEventListener('mouseup', this.onDocumentMouseUp, false);
	        
		},
		onDocumentMouseDown: function(event){
			if(event.button == 2){
				CameraController.mousePos.x = "";
				CameraController.mousePos.y = "";
				MouseEventListener.button = event.button;
				CameraController.snipe();
			}else{
				ShootController.shoot();
				CameraController.cancelSnipe();
//				GunVoiceContrller.play();
			}
			
		},
		
		onDocumentTouchStart: function(event){
			alert("aaaaaaaaaaaa");
		},
		
		onDocumentTouchMove: function(event){
			
		},
		
		onDocumentMouseMove: function(event){
			if(MouseEventListener.button == 0){
				CameraController.handleMouseMove(event);
			}
		},
		
		onDocumentMouseUp: function(event){
			if(MouseEventListener.button == 2){
				MouseEventListener.button = 0;
			}
			
		},
		
}